potential memory leak in pg_regcomp()

  • Jump to comment-1
    zyu@yugabyte.com2022-07-23T03:20:04+00:00
    Hi, I was looking at pg_regcomp(): re->re_guts = VS(MALLOC(sizeof(struct guts))); I did some search trying to find where re_guts is freed but haven't found it. Can someone enlighten me? Thanks
    • Jump to comment-1
      tgl@sss.pgh.pa.us2022-07-23T03:49:25+00:00
      Zhihong Yu <zyu@yugabyte.com> writes: > I was looking at pg_regcomp(): > re->re_guts = VS(MALLOC(sizeof(struct guts))); > I did some search trying to find where re_guts is freed but haven't > found it. In rfree(), which is called from freev(). regards, tom lane
    • Jump to comment-1
      michael@paquier.xyz2022-07-23T03:29:17+00:00
      On Fri, Jul 22, 2022 at 08:20:04PM -0700, Zhihong Yu wrote: > Hi, > I was looking at pg_regcomp(): > > re->re_guts = VS(MALLOC(sizeof(struct guts))); > > I did some search trying to find where re_guts is freed but haven't > found it. > Can someone enlighten me? Oops. It seems that you are right and that there is room for improvement here. regguts.h defines MALLOC() as a simple malloc().. -- Michael